<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1,width=device-width">
    <title>负债详情</title>
    <link href="../Content/css/style.css" rel="stylesheet">
    <script src="../Content/js/rem.js"></script>
    <style>

    </style>
</head>
<body>
<div id="loading">
    <img src="../Content/imgs/kbloading.gif" >
</div>
    <div class="wrap" >
        <div class="fzhead">
            <div class="mytx">
                <img src="../Content/imgs/gril.jpg" id="img">
            </div>
            <p class="ck-name" id="name">*****</p>
        </div>

        <ul class="fzlist">
            <li>借款金额<span id="jkze">5000</span></li>
            <li>待还金额 <span id="dhje">300</span></li>
            <li >借入次数 <span id="jrcs">3次</span></li>
            <li >借入人数 <span id="jrrs">3人</span></li>
        </ul>
        <ul class="fzlist" style="border-bottom: 0">
            <li >逾期金额<span id="yqje">0.00</span></li>
            <li>逾期次数<span id="yqcs">0次</span></li>
        </ul>
        <p class="jrlb">借入列表</p>
        <ul class="jrlist" id="jrlist">
            <!--<li><span>2017-02-26</span><span class="cen">借款2360元</span><span class="right wh">未还</span></li>-->

        </ul>
    </div>
    <script src="../Content/js/jquery-2.2.4.min.js"></script>
<script>
    //获取页面传递参数
    var url="http://192.168.199.136:8080/daiqianlai";
    let urs=window.location.search;
    let strs=urs.substring(1);
    let silp=strs.split('&');
    let res={};
    for (let i=0;i<silp.length;i++){
        res[silp[i].split("=")[0]]=silp[i].split("=")[1];
    }
    console.log(res);
    var Cjrid=res.cjrid;
    $.ajax({
        type : "GET",
        url : url+"/borrow/getLoanUserByid",
        dataType : 'json',
        async: false,
        contentType : "application/json",
        data :{
            id:Cjrid
        },
        success : function(ro) {
            var Name="";
            console.log(ro);
            if(ro.user.name.length==2){
                Name= ro.user.name.substring(0,1)+"*"
            }else if(ro.user.name.length==3){
                Name= ro.user.name.substring(0,1)+"*"+ro.user.name.substring(2,3)
            }else if(ro.user.name.length==4){
                Name= ro.user.name.substring(0,1)+"**"+ro.user.name.substring(3,4)
            }
            $("#name").html(Name);
            $("#img").attr('src',ro.user.tou);
            $("#jkze").html(ro.user.sum_borrow_money);
            $("#dhje").html(ro.user.norefund_money);
            $("#jrcs").html(ro.user.borrow_num+"次");
            $("#jrrs").html(ro.user.borrow_user_num+"人");
            $("#yqje").html(ro.user.sum_overdue_money);
            $("#yqcs").html(ro.user.overdue_num+"次");
            console.log(ro.list);
            var strs="";
            $.each(ro.list,function (index,el) {
                if(ro.list[index].isrefund==0){
                    strs+=` <li><span>`+ro.list[index].loan_date+`</span><span class="cen">借款`+ro.list[index].money+`元</span><span class="right wh">未还</span></li>`
                }else {
                    strs+=` <li><span>`+ro.list[index].loan_date+`</span><span class="cen">借款`+ro.list[index].money+`元</span><span class="right">已还</span></li>`
                }
                //console.log(index)
            });
            $(strs).appendTo("#jrlist");
            $("#loading").hide();
        },
        error : function(err) {
            alert(err);
        }
    });
    var winH=$(window).height();
    $(".wrap").css("height",winH);
    $(function(){


    });

</script>
</body>
</html>
